﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Data;

namespace ConfExpert.Forms.Depo.Westbrook
{
    public partial class Ref : XForm
    {
        public Ref()
        {
            InitializeComponent();
        }

        DataTable DtTranslate = null;
        public Ref(DataTable dt)
            : this() 
        {
            DtTranslate = new DataTable();
            DtTranslate.Merge(dt);
        }

        private void Ref_Load(object sender, EventArgs e)
        {
            

            if (DtTranslate == null)
            {
                gridView1.Init("WBTranslate3");
            }
            else
            {
                txtInfo.Caption = "Seçili sipariş satır(lar)ında geçen terimler";
                gridView1.Init(DtTranslate);
            }
            gridView1.Columns["EN"].ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemTextEdit();
            gridView1.MakeColumnInvisible("CustomerId");
            gridView1.AddSummary();
            gridView1.BestFitColumns();
            gridView1.Columns["TR"].Width = 300;

            btnKaydet.ItemClick += btnKaydet_ItemClick;
        }

        void btnKaydet_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView1.EndEditing();
            gridView1.Update("", "KFref");
            if (DtTranslate != null)
            {
                this.Close();
            }
        }

    }
}
